{{useCss "app-pages/css/main.scss",(["/main.html","/"]) }}
<div class="main_top">
    <div class="box">
        <div class="classify_box">
            {{#each $Cache.main.classify_tree.childs}}
            <div class="classify">
                <href class="name" to="/classify.html?root_id={{classify._id}}">
                    {{classify.classify_name}}
                </href>
                <div class="childs_box">
                    {{#each childs}}
                    <href class="child" to="/classify.html?second_id={{classify._id}}">
                        <img bind-src="{{classify.icon_url}}?imageView/1/w/80" />{{classify.classify_name}}
                    </href>
                    {{/each}}
                </div>
            </div>
            {{/each}}
        </div>
        <div class="picwall">
            {{#> "picwall"}}
        </div>
        <div class="other">
            {{#each $Cache.main.random_goods}}
                <href to="/goods_details.html?id={{_id}}">
                    <div class="random_goods">
                        <div class="pre">
                            <img bind-src="{{preview_img_url}}?imageView/1/w/100/h/100" />
                        </div>
                        <div class="info">
                            <div class="name">{{goods_name}}</div>
                            <div class="price">￥{{card_cash_map[$Top.loginer.current_card_factory_id]||cash}}</div>
                        </div>
                    </div>
                </href>
            {{/each}}
        </div>
    </div>
</div>

<div class="main_body">
   <!--  <div class="store_list">
        {{#each $Cache.main.store_list}}
        <href to="/store_preview.html?geotable_id={{uid}}">
            <div class="store">
                <img bind-src="{{logo_url}}?imageView/1/w/500/h/300" />
                <div class="title">{{title}}</div>
            </div>
        </href>
        {{/each}}
    </div> -->

    {{#each $Cache.main.classify_list}}
    {{#if contents.length}}
    <div class="block">
        <div class="main_title">
            <div class="h_title"></div>
            <div class="text">{{title}}</div>
            <div class="h_title"></div>
        </div>
        <div class="goods_box">
            {{#each contents}}
                {{#> "_goods_box-contents-item","$This", 10>$Index}}
            {{/each}}
            <xmp type="template" name="_goods_box-contents-item">
                <href to="/goods_details.html?id={{_id}}">
                    <div class="item">
                        <div class="img">
                            <img bind-src="{{preview_img_url}}?imageView/1/w/239/h/239" />
                        </div>
                        <div class="info">
                            <div class="name">{{goods_name}}</div>
                            <div class="price">￥{{card_cash_map[$Top.loginer.current_card_factory_id]||cash}}</div>
                        </div>
                    </div>
                </href>
            </xmp>
        </div>
    </div>
    {{/if}}
    {{/each}}
</div>

<xmp type="template" name="picwall">
    <div class="box">
        {{#each bus_info.config.home_imgs}}
        <img bind-src="{{img_url}}?imageView/2/w/645/h/450/q/98" />
        {{/each}}
    </div>
    {{#if bus_info.config.home_imgs.length>1}}
    <div class="select">
        <div class="selectbox">
        {{#each bus_info.config.home_imgs}}
            <div class="item {{($Top.$Cache.main.picwall_play_num==$Index)&&'focus'}}" data="$Index" event-click="{{'$Top.$Event.main.change_picwall_num'}}"></div>
        {{/each}}
        </div>
    </div>
    {{/if}}
    <script type="text/vm">
    function(vm) {
        var movebox = vm.queryElement({
            className: "box"
        })[0];
        require(["jQuery"], function($) {
            var $movebox = $(movebox);
            var imgs = $movebox.find("img");
            var len = imgs.length;
            var _i = 0;
            App.set("$Cache.main.picwall_play_num", 0);
            setInterval(function() {
                App.set("$Cache.main.picwall_play_num", _i % len);
                _x = "translateX(-" + ((_i % len) * 100) + "%)";
                $movebox.css({
                    transform: (_x)
                });
                _i += 1;
            }, 5000);
            vm.set("$Event.main.change_picwall_num", function(e, cvm) {
                _i = cvm.get("$Index");
                App.set("$Cache.main.picwall_play_num", _i % len);
                 _x = "translateX(-" + ((_i % len) * 100) + "%)";
                $movebox.css({
                    transform: (_x)
                });
            });
        });
    }
    </script>
</xmp>
